﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
namespace SpaceKinect
{
    class SliderBar
    {
        private Vector2 Slider;
        private Vector2 Left;
        private Vector2 Right;
        private float Value;
        public SliderBar(Vector2 left, Vector2 right, float SliderVal)
        {
            Left = left;
            Right = right;
            setValue(SliderVal);
            Slider = Left;
            Slider.X += (Right.X - Left.X) / 2;
        }

        private void UpdateSlider()
        {
            //Scales slider position to value
            Slider.X = Left.X + (Value*10*3.33f);

        }

        public Vector2 getSlider()
        {
            return Slider;
        }

        public float getValue()
        {
            if (Value == -0.1)
            {
                return 0;
            }
            return Value;
        }
        
        /// <param name="Val">Volume scale value between 0 and 1</param>
        public void setValue(float Val)
        {
            //Sets value to the input value (between 0f and 1f)
            Value = Val;
            //Updates sliderball position
            UpdateSlider();
        }
    }
}
